package com.matt.sooncleaner.notification

import android.content.pm.ActivityInfo
import android.content.pm.ApplicationInfo
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.graphics.drawable.Drawable

/**
 *
 * Created by xiexiang10 on 2024/6/17.
 **/
data class AppInfo(
    val packageName: String,
    val icon: Drawable? = null,
    val appName: String? = "",
    var isEnableBlock: Boolean = false
)

fun PackageInfo.toAppInfo(pm: PackageManager): AppInfo {
    val appName = applicationInfo.loadLabel(pm)
    return AppInfo(
        packageName,
        pm.getApplicationIcon(packageName),
        appName.toString(),
        NotificationHelper.isEnableBlock(packageName)
    )
}